//
//Copyright GX. Yuan
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @file net.go
 * @brief Leetcode practice
 * @details 36. 有效的数独
 * @author GX. Yuan  any question please send mail to yuanguanxu@qq.com
 * @date 2021-6-28
 * @version V1.0
 * @attention 硬件平台: windows 10 家庭版
 * SDK版本：Go 1.16.5
 * IDE版本：GoLand 2020.2.3
 */
package main

import (
	"bytes"
)

func isValidSudoku(board [][]byte) bool {
	// 规则1；每一行只能出现一次
	var lin,col=0,0
	var sliceTemp =make([]byte,9)
	var colSliceTemp=make([]byte,9)
	var point byte ='.'
	for lin=0; lin<9;lin++ {
		for col=0;col<9;col++ {
			if board[lin][col]!=point{
				if bytes.Contains(sliceTemp,[]byte{board[lin][col]}) {
					return false
				}else{
				sliceTemp=append(sliceTemp,board[lin][col])
				}
			}
			if board[col][lin]!=point {
				if bytes.Contains(colSliceTemp,[]byte{board[col][lin]}) {
						return false
				}else{
					colSliceTemp=append(colSliceTemp,board[lin][col])
				}
			}
		}
		sliceTemp=sliceTemp[:0]
		colSliceTemp=colSliceTemp[:0]
	}
	return false
}

func main() {

}
